package com.springapp.mvc.services;

import com.springapp.mvc.entity.CommentForPost;
import com.springapp.mvc.entity.Post;
import com.springapp.mvc.entity.UserPost;
import org.springframework.security.access.prepost.PreAuthorize;

import java.io.IOException;
import java.util.List;

public interface PostingService {

    public List<UserPost> getPosts(Long start, Long end);

    public void addMessage(Long userId, String postText);

    @PreAuthorize("hasRole('ROLE_SUPERVISOR')")
    public void addMessage(Long userId, String messageText, byte[] imageBytes) throws IOException;

    void createComment(Long postId, Long userId, String comment);

    List<CommentForPost> getCommentsForPost(Long postId);

    Post getPostById(Long postId);

    @PreAuthorize("hasRole('ROLE_ADMIN')")
    public void deleteMessage(Long postId);

    @PreAuthorize("hasRole('ROLE_SUPERVISOR')")
    public void editMessage(Long postId, String newText);
}
